﻿using System;

namespace EventModifiers
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Foo foo = new Foo();
            foo.VirtualEvent += Foo_VirtualEvent;
            foo.TestVirtualEvent();

        }

        private static void Foo_VirtualEvent(object sender, EventArgs e)
        {
            Console.WriteLine("我执行了");
        }
    }

    public class BaseEventArgs : EventArgs
    {
        public string Name
        {
            get;
            set;
        }
    }

    public class Foo
    {
        public virtual event EventHandler<EventArgs> VirtualEvent;

        public void TestVirtualEvent()
        {
            VirtualEvent?.Invoke(this, null);
        }
    }

    public class Foo2 : Foo
    {
        //重写的意图在何？有什么用
        public override event EventHandler<EventArgs> VirtualEvent;
    }
}
